<!--  -->
<template>
    <div class='' style="background:#F5F7F9;width: 100%;height: 100%">

        <!--社保方案设置-->
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark">
                <div style="width: 1200px;height: 60px;background: white;border-radius: 5px;border-bottom: 2px solid #F5F7F9;line-height: 60px">
                    <div style="margin-left: 20px;font-weight: 600">公积金方案设置</div>
                </div>
                <div style="width: 1200px;height: 180px;background: white;border-radius: 5px;border-bottom: 2px solid #F5F7F9;line-height: 60px;overflow: hidden">
                    <div style="margin-left: 60px;font-weight: 600;font-size: 15px;color: red;margin-top: 20px">
                        *
                    </div>
                    <div style="margin-left: 75px;font-weight: 200;font-size: 15px;margin-top: -63px">
                        方案名称：
                    </div>
                    <div style="margin-top: -62px">
                        <el-input v-model="map.schemeName" placeholder="请输入" style="width: 300px;margin-left: 150px"></el-input>
                    </div>
                    <div style="margin-left: 105px;font-weight: 200;font-size: 15px;margin-top: -13px">
                        备注：
                    </div>
                    <div style="margin-top: -52px">
                        <el-input
                                style="width: 300px;margin-left: 150px"
                                type="textarea"
                                :rows="4"
                                placeholder="请输入"
                                v-model="map.remark">
                        </el-input>
                    </div>
                </div>
            </div></el-col>
        </el-row>
        <!--方案配置-->
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark">
                <div style="width: 1200px;height: 60px;background: white;border-radius: 5px;border-bottom: 2px solid #F5F7F9;line-height: 60px;margin-top: 20px;overflow: hidden">
                    <div  @click="b()" style="margin-left: 10px;font-weight: 600;width: 80px;height: 50px;text-align: center;margin-top: 8px;line-height: 40px" :class="div1">方案配置</div>
                    <div  @click="c()" style="margin-top:-50px;margin-left: 120px;font-weight: 600;width: 80px;height: 50px;text-align: center;line-height: 40px" :class="div2">关联人员</div>
                </div>



                <div v-if="peopleShow" style="width: 1200px;height: 550px;background: white;margin-top: 0px;overflow: hidden">
                    <div style="width: 90%;height: 35px;background: #F5F7F9;margin-left: 55px;margin-top: 30px;border-bottom: 1px solid #E3E8EE;border-top: 1px solid #E3E8EE">
                        <ul style="list-style: none">
                            <li style="float: left;font-size: 10px;line-height: 35px;margin-left:40px;color: #33A5FD" @click="openInsu()">+ 添加</li>
                            <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px;">缴纳对象</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px;">缴纳基数</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">基数下限</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">基数上限</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">缴纳比例</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">缴纳金额</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">有效小数位</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:60px">小数保留规则</li>
                            <li  style="float: left;float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:50px">操作</li>
                        </ul>
                        <div>
                            <div style="margin-left: 0px;width: 100%;height: 40px;margin-top: 40px" v-if="dialogVisible">
                                <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left: 30px;margin-top: 10px">全选</el-checkbox>
                                <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange"  style="margin-top: -18px;margin-left: 120px">
                                    <el-checkbox v-for="city in socials" :label="city" :key="city">{{city}}</el-checkbox>
                                </el-checkbox-group>
                            </div>
                        </div>
                        <div v-if="inseranceLists.length>0" v-for="(item,index) in inseranceLists" :key="index">
                            <div style="width: 1080px;border-bottom: 1px solid #E3E8EE;height: 85px;border-top: 1px solid #E3E8EE">
                                <ul style="list-style: none">
                                    <li style="float: left;font-size: 15px;line-height: 35px;margin-left:27px;margin-top: 20px">{{item.corporationinformations.insuranceName}}</li>

                                    <li  style="float: left;color: #657180;font-size: 15px;line-height: 35px;margin-left:60px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li>公司</li>
                                            <li>个人</li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:52px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li><el-input @change="corporationinformationsPay(index,item)" v-model="item.corporationinformations.payCardinal" placeholder="请输入" style="width: 80px"></el-input></li>
                                            <li><el-input @change="myinformationsPay(index,item)" v-model="item.myinformations.payCardinal" placeholder="请输入" style="width: 80px"></el-input></li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:25px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li><el-input v-model="item.corporationinformations.baseLower" placeholder="请输入" style="width: 80px"></el-input></li>
                                            <li><el-input v-model="item.myinformations.baseLower" placeholder="请输入" style="width: 80px"></el-input></li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li><el-input v-model="item.corporationinformations.baseCap" placeholder="请输入" style="width: 80px"></el-input></li>
                                            <li><el-input v-model="item.myinformations.baseCap" placeholder="请输入" style="width: 80px"></el-input></li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li><el-input v-model="item.corporationinformations.payScale" placeholder="请输入" style="width: 80px"></el-input></li>
                                            <li><el-input v-model="item.myinformations.payScale" placeholder="请输入" style="width: 80px"></el-input></li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li><el-input :disabled="true" v-model="item.corporationinformations.payReceived" placeholder="请输入" style="width: 80px"></el-input></li>
                                            <li><el-input :disabled="true" v-model="item.myinformations.payReceived" placeholder="请输入" style="width: 80px"></el-input></li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li>
                                                <el-select @change="corporationinformationsPay(index,item)" v-model="item.corporationinformations.significant" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in options"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </li>
                                            <li>
                                                <el-select @change="myinformationsPay(index,item)" v-model="item.myinformations.significant" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in options"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li>
                                                <el-select v-if="item.corporationinformations.significant !== 3" disabled  @change="corporationinformationsPay(index,item)" v-model="item.corporationinformations.decimalPoint" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in optiones"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>
                                                <el-select v-if="item.corporationinformations.significant == 3"  @change="corporationinformationsPay(index,item)" v-model="item.corporationinformations.decimalPoint" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in optiones"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </li>
                                            <li>
                                                <el-select v-if="item.myinformations.significant !== 3" disabled @change="myinformationsPay(index,item)" v-model="item.myinformations.decimalPoint" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in optiones"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>

                                                <el-select v-if="item.myinformations.significant == 3" @change="myinformationsPay(index,item)" v-model="item.myinformations.decimalPoint" placeholder="请选择" style="width: 90px">
                                                    <el-option
                                                            v-for="item in optiones"
                                                            :key="item.value"
                                                            :label="item.label"
                                                            :value="item.value">
                                                    </el-option>
                                                </el-select>
                                            </li>
                                        </ul>
                                    </li>

                                    <li  style="float: left;color: #657180;font-size: 10px;line-height: 35px;margin-left:30px;margin-top: 8px">
                                        <ul style="list-style: none">
                                            <li style="line-height: 60px;margin-left: 12px;font-size: 15px;color: red" @click="deleteSocial(item,index)">移除</li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <div v-if="peopleShow == false" style="width: 1200px;height: 550px;background: white;margin-top: 0px;overflow: hidden">
                    <div style="margin-left: 20px;margin-top: 10px">
                        <el-button type="primary" @click="addPeople()">添加</el-button>
                        <el-button @click="delPeople()">移除</el-button>
                    </div>
                    <el-table
                            border
                            :data="peopleLists"
                            fit
                            highlight-current-row
                            @selection-change="handleSelectionChanges"
                            style="width: 77%;margin-top: 20px;margin-left: 30px">
                        <el-table-column
                                align="center"
                                type="selection"
                                width="50">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="ozId"
                                label="序号"
                                width="60">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="bname"
                                label="姓名"
                                width="60">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="departmentName"
                                label="部门"
                                width="60">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="positionName"
                                label="岗位"
                                width="70">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="phone"
                                label="手机号码"
                                width="100">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="number"
                                label="工号"
                                width="130">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="idNumber"
                                label="证件号"
                                width="100">
                        </el-table-column>
                        <el-table-column align="center" label="员工类型" width="100">
                            <template slot-scope="p">
                                {{ p.row.employeeStatus === 1 ? "正式" : "试用" }}
                            </template>
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="schemeName"
                                label="当前方案"
                                width="100">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="declaration"
                                label="申报基数"
                                width="100">
                        </el-table-column>
                    </el-table>
                    <!--关联人员信息弹出信息-->
                    <el-dialog title="关联人员信息" :visible.sync="socialPeople">
                        <!--模糊查-->
                        <el-form :inline="true" :model="maps" class="demo-form-inline">
                            <el-form-item>
                                <el-input v-model="maps.mess" placeholder="请输入姓名/工号/证件号/手机号" style="width: 200px"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-input v-model="maps.departmentName" placeholder="请输入部门"></el-input>
                                <img @click="openMenus()" src="https://edu-2004-0926.oss-cn-beijing.aliyuncs.com/%E6%A0%91%E5%BD%A2%E6%8E%A7%E4%BB%B6.png" style="width: 15px;height: 15px; position: absolute; top: 7px; left: 146px;">
                            </el-form-item>
                            <el-select v-model="maps.staffType" placeholder="请选择">
                                <el-option label="正式" value=1></el-option>
                                <el-option label="试用" value=0></el-option>
                            </el-select>
                            <el-form-item>
                                <el-button type="primary" style="margin-left: 20px" @click="addPeople()">查询</el-button>
                            </el-form-item>
                            <el-form-item>
                                <el-button style="margin-left: 10px" @click="resetting()">重置</el-button>
                            </el-form-item>
                        </el-form>
                        <el-dialog title="选择部门" :visible.sync="departShow" style="width: 500px;height: 800px;margin-left: 500px">
                            <el-tree
                                    :data="departList"
                                    :props="defaultProps"
                                    :expand-on-click-node="false"
                                    node-key="id"
                                    @node-click="getDepartValue"
                                    :draggable="true"
                                    @node-contextmenu="contextmenu"
                                    ref="menuTree"
                                    style="width: 200px"
                            >
                            </el-tree>
                        </el-dialog>
                        <!--数据-->
                        <el-table
                                v-loading="peopleLoading"
                                border
                                :data="peopleList"
                                element-loading-text="数据加载中"
                                fit
                                highlight-current-row
                                @selection-change="handleSelectionChange"
                                style="width: 100%">
                            <el-table-column
                                    align="center"
                                    type="selection"
                                    width="50">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="ozId"
                                    label="序号"
                                    width="60">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="bname"
                                    label="姓名"
                                    width="60">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="departmentName"
                                    label="部门"
                                    width="60">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="positionName"
                                    label="岗位"
                                    width="70">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="phone"
                                    label="手机号码"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="number"
                                    label="工号"
                                    width="130">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="idNumber"
                                    label="证件号"
                                    width="100">
                            </el-table-column>
                            <el-table-column align="center" label="员工类型" width="100">
                                <template slot-scope="p">
                                    {{ p.row.employeeStatus === 1 ? "正式" : "试用" }}
                                </template>
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="schemeName"
                                    label="当前方案"
                                    width="100">
                            </el-table-column>
                            <el-table-column
                                    align="center"
                                    prop="declaration"
                                    label="申报基数"
                                    width="100">
                            </el-table-column>
                        </el-table>
                        <!--分页-->
                        <el-pagination
                                :current-page.sync="maps.socialDto.page"
                                :page-size="maps.socialDto.pagesize"
                                :page-sizes="[10, 20, 30, 40]"
                                :total="poepleTotal"
                                background
                                layout="total, sizes ,prev, pager, next, jumper"
                                style="padding: 30px 0; text-align: center"
                                @current-change="addPeople"
                                @size-change="handleSizeChanges"
                        />
                        <el-button style="margin-left: 700px" @click="noPeople()">取消</el-button>
                        <el-button type="primary" @click="closePeople()">确定</el-button>
                    </el-dialog>
                </div>

                <div style="margin-top: 10px;margin-left: 20px;">
                    <el-button @click="fanhui">返回</el-button>
                    <el-button @click="fanhui">取消</el-button>
                    <el-button type="primary" @click="judgeScheme">保存</el-button>
                </div>
            </div></el-col>
        </el-row>
    </div>
</template>

<script>
    //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
    //例如：import 《组件名称》 from '《组件路径》';

    export default {
        //import引入的组件需要注入到对象中才能使用
        components: {},
        data() {
        //这里存放数据
            return {
                peopleLoading: true,
                //部门数据
                departList:[],
                defaultProps: {
                    children: "children",
                    label: "departName"
                },
                //部门数据展示
                departShow:false,
                socialPeople:false,
                peopleShow:true,
                div1:"div1",
                div2:"div2",
                optiones: [{
                    value: 1,
                    label: '1位'
                }, {
                    value: 2,
                    label: '2位'
                }, {
                    value: 3,
                    label: '3位'
                }],
                options: [{
                    value: 1,
                    label: '四舍五入'
                }, {
                    value: 2,
                    label: '取整'
                }, {
                    value: 3,
                    label: '进位取整'
                }],
                insurcceList:[],
                dialogVisible:true,
                //所有社保险种
                socialData:[],
                socialId:null,
                socials:null,
                //添加的数据
                map:{
                    schemeName:null,
                    remark:null,
                    relatedPerson:null,
                    insurcanceListDtos:{

                    },
                },
                inseranceLists:[],
                checkedCities:[],
                isIndeterminate:true,
                checkAll: false,
                value:3,
                //查询人员信息需要用的数据
                maps:{
                    socialId:null,
                    departmentName:null,
                    departmentId:null,
                    staffType:null,
                    mess:null,
                    socialDto:{
                        page:1,
                        pagesize:10
                    }
                },
                peopleList:[],
                poepleTotal:0,
                peopleLists:[],
                ids:[],
                ozIds:[]
            };
        },
        //监听属性 类似于data概念
        computed: {},
        //监控data中的数据变化
        watch: {},
        //方法集合
        methods: {
            fanhui(){
                this.$router.push('/accumScheme')
            },
            noPeople(){
                this.socialPeople = false
                this.map.relatedPerson = null
            },
            closePeople(){
                this.socialPeople = false
                this.peopleLists = []
                this.request.post("/staff/accounting/selAllPeopleHasNoSocial",this.ids)
                .then(res=>{
                    this.peopleLists = res.data
                })
            },
            handleSelectionChanges(val) {
                this.ozIds = []
                for (let i = 0; i < val.length; i++) {
                    this.ozIds.push(val[i].ozId)
                }
            },
            delPeople(){
                for (let j = 0; j < this.ozIds.length; j++) {
                    for (let i = 0; i < this.peopleLists.length; i++) {
                        if(this.peopleLists[i].ozId === this.ozIds[j]){
                            this.peopleLists.splice(i,1)
                            this.delPeople()
                        }
                    }
                }
                this.map.relatedPerson = null
                for (let i = 0; i < this.peopleLists.length; i++) {
                    this.map.relatedPerson=this.map.relatedPerson+this.peopleLists[i].ozId+','
                }
                if(this.map.relatedPerson !== null){
                    this.map.relatedPerson = this.map.relatedPerson.substr(0,this.map.relatedPerson.length-1)
                }
                console.log(this.map.relatedPerson)
            },
            //批量操作
            handleSelectionChange(val) {
                this.map.relatedPerson = null
                for (let i = 0; i < val.length; i++) {
                    this.map.relatedPerson=this.map.relatedPerson+val[i].ozId+','
                    this.ids.push(val[i].ozId)
                }
                if(this.map.relatedPerson !== null){
                    this.map.relatedPerson = this.map.relatedPerson.substr(0,this.map.relatedPerson.length-1)
                }
            },
            //当部门被选中时
            contextmenu(event,data,node){
                this.node = node
                this.data = data
            },
            //分页跳转数据
            handleSizeChanges(pageSize) {
                this.maps.socialDto.pagesize = pageSize;
                this.selstaffBySocial();
            },
            //树形查询所有部门
            selAllDepartTree(){
                this.request.get("/staff/department/selAllDepartTree")
                    .then(res=>{
                        this.departList = res.data
                    })
            },
            //当部门被选中时
            getDepartValue(data){
                this.maps.departmentName = data.departName
                this.departShow = false
            },
            //查询人员信息
            addPeople(){
                this.socialPeople = true
                this.selAllDepartTree()
                this.request.post("/staff/accounting/selstaffBySocial",this.maps)
                .then(res=>{
                    this.peopleLoading = false
                    this.peopleList = res.items
                    this.poepleTotal = res.counts
                    this.socialPeople = true
                })
            },
            b () {
                this.div1 = "div11"
                this.div2 = "div2"
                this.peopleShow = true
            },
            c (){
                this.div2 = "div22"
                this.div1 = "div1"
                this.peopleShow = false
            },
            insertSocial(){
                this.request.post("/salary/accumulation/insertaccumulation",this.map)
                .then(res=>{
                    this.$message({
                        showClose: true,
                        message: "添加成功!",
                        type: 'success'
                    });
                    this.fanhui()
                })
            },
            judgeScheme(){
              this.request.get("/salary/accumulation/judgeSchemeAcc",{
                  params:{
                      schemeName:this.map.schemeName
                  }
              }).then(res=>{
                  if (res.data == true){
                        this.insertSocial()
                  }else {
                      this.$message({
                          showClose: true,
                          message: "方案名称已存在!",
                          type: 'warning'
                      });
                  }
              })
            },
            //删除方案配置信息
            deleteSocial(item,index){
                this.inseranceLists.splice(index, 1)
                switch (item.myinformations.insuranceName) {
                    case "房贷公积金" :
                        delete this.map.insurcanceListDtos.providentFund
                        break
                }
            },
            myinformationsPay(index,item){
                const info = this.inseranceLists[index]
                const a = Number(info.myinformations.payCardinal)
                const b = (Number(info.myinformations.payScale.substr(0, info.myinformations.payScale.length - 1)) / 100)
                let c = 0;
                if(item.myinformations.significant == 1){
                    c = Math.round(a*b);
                }
                if(item.myinformations.significant == 2){
                    c = Math.trunc(a*b);
                }
                if(item.myinformations.significant == 3){
                    if(item.myinformations.decimalPoint == 1){
                        c = (a*b).toFixed(1)
                    }
                    if(item.myinformations.decimalPoint == 2){
                        c =  (a*b).toFixed(2)
                    }
                    if(item.myinformations.decimalPoint == 3){
                        c = (a*b).toFixed(3)
                    }
                }
                info.myinformations.payReceived = c
                switch (item.myinformations.insuranceName) {
                    case "房贷公积金" :
                        this.map.insurcanceListDtos.providentFund.myinformations.payReceived =  c
                        break
                }
            },
            corporationinformationsPay(index,item){
                const info = this.inseranceLists[index]
                const a = Number(info.corporationinformations.payCardinal)
                const b = (Number(info.corporationinformations.payScale.substr(0, info.corporationinformations.payScale.length - 1)) / 100)
                let c = 0;
                if(item.corporationinformations.significant == 1){
                     c = Math.round(a*b);
                }
                if(item.corporationinformations.significant == 2){
                     c = Math.trunc(a*b);
                }
                if(item.corporationinformations.significant == 3){
                    if(item.corporationinformations.decimalPoint == 1){
                        c = (a*b).toFixed(1)
                    }
                    if(item.corporationinformations.decimalPoint == 2){
                       c =  (a*b).toFixed(2)
                    }
                    if(item.corporationinformations.decimalPoint == 3){
                       c = (a*b).toFixed(3)
                    }
                }
                info.corporationinformations.payReceived = c
                switch (item.corporationinformations.insuranceName) {
                    case "房贷公积金" :
                        this.map.insurcanceListDtos.providentFund.corporationinformations.payReceived = c
                        break
                }
            },
            openInsu(){
                if(this.dialogVisible == true){
                    this.dialogVisible = false
                }else {
                    this.dialogVisible = true
                }
            },
            selAllInsuName(){
                //查询所有社保险种
                this.request.get("/salary/insurance/selAllInsuName",{
                    params:{
                        insuranceType:0
                    }
                }).then(res=>{
                   this.socialData = res.data
                    this.socials = this.socialData
                })
            },
            getInsurance(){
                this.request.post("/salary/insurance/getInsurance", this.checkedCities)
                .then(res=>{
                    this.insurcceList = res.data
                    for (let i = 0; i < this.insurcceList.length; i++) {
                        const corporationinformations = {
                            socialSecurity:2,
                            sociaId:null,
                            sociaName:this.insurcceList[i].saId,
                            insuranceName:this.checkedCities[i],
                            paylName:"公司",
                            payCardinal:"",
                            baseLower:5869.00,
                            baseCap:31884.00,
                            payScale:this.insurcceList[i].comProportion,
                            payReceived:0,
                            significant:2,
                            decimalPoint:""
                        }
                        const myinformations = {
                            socialSecurity:2,
                            sociaId:null,
                            sociaName:this.insurcceList[i].saId,
                            insuranceName:this.checkedCities[i],
                            paylName:"个人",
                            payCardinal:"",
                            baseLower:5869.00,
                            baseCap:31884.00,
                            payScale:this.insurcceList[i].indProportion,
                            payReceived:0,
                            significant:2,
                            decimalPoint:""
                        }
                        const insuranc = {
                            corporationinformations,
                            myinformations
                        }
                        this.getDataKey(this.insurcceList[i].insuranceName, corporationinformations, myinformations)
                        this.inseranceLists.push(insuranc)
                    }
                })
            },
            getDataKey (param,corporationinformations,myinformations) {
                switch (param) {
                    case "房贷公积金" :
                        this.map.insurcanceListDtos.providentFund = {}
                        this.map.insurcanceListDtos.providentFund.corporationinformations = corporationinformations
                        this.map.insurcanceListDtos.providentFund.myinformations = myinformations
                        break
                }
            },
            handleCheckAllChange(val) {
                this.checkedCities = val ? this.socialData : [];
                this.isIndeterminate = false;
                this.inseranceLists = []
                this.map.insurcanceListDtos = {}
                if(this.checkedCities.length>0){
                    this.getInsurance()
                }
            },
            handleCheckedCitiesChange(value) {
                let checkedCount = value.length;
                this.checkAll = checkedCount === this.socials.length;
                this.isIndeterminate = checkedCount > 0 && checkedCount < this.socials.length;
                this.inseranceLists = []
                this.map.insurcanceListDtos = {}
                if(this.checkedCities.length>0){
                    this.getInsurance()
                }
            }
        },
        //生命周期 - 创建完成（可以访问当前this实例）
        created() {
            this.selAllInsuName()
        },
        //生命周期 - 挂载完成（可以访问DOM元素）
        mounted() {

        },
        beforeCreate() {}, //生命周期 - 创建之前
        beforeMount() {}, //生命周期 - 挂载之前
        beforeUpdate() {}, //生命周期 - 更新之前
        updated() {}, //生命周期 - 更新之后
        beforeDestroy() {}, //生命周期 - 销毁之前
        destroyed() {}, //生命周期 - 销毁完成
        activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
    }
</script>
<style scoped>
.div1{

}
.div2{

}
.div11{
    border-bottom: 1px solid #3c9cff;
    color: #3c9cff;
}
.div22{
    border-bottom: 1px solid #3c9cff;
    color:  #3c9cff;
}
</style>
